# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=pipesocks
pkgver=2.3
pkgrel=4
pkgdesc='A pipe-like SOCKS5 tunnel system'
arch=('loong64' 'x86_64')
url="https://github.com/pipesocks/pipesocks"
license=('GPL3')
depends=('qt5-declarative' 'qt5-quickcontrols2' 'libsodium')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pipesocks/pipesocks/archive/$pkgver.tar.gz")
sha512sums=('2524432528d46a24d2a31446a6fee50d3192b6d56a8ac9fd7055ef67614975e6378f59df48d9fd6113a3e09536a3149ca1069bec0f1db7f071db475e88b160c3')

prepare() {
  cd pipesocks-$pkgver/pipesocks

  # Disable transparent - dunno why it shows as completely transparent :/
  sed -i 's/,0.8/,1/' Main.qml

  # QSystemTrayIcon is in QtWidgets, so we need QApplication to initialize
  sed -i 's/QGuiApplication/QApplication/' *.cpp *.h
}

build() {
  cd pipesocks-$pkgver/pipesocks
  qmake-qt5 PREFIX=/usr
  make
}

package() {
  cd pipesocks-$pkgver/pipesocks
  install -Dm755 pipesocks "$pkgdir"/usr/bin/pipesocks
}
